#include "threadyb.h"

ThreadYb::ThreadYb(QObject* )
{



}
void ThreadYb::doWork(int mod, QString inp)
{

    qDebug()<<"receive the execute signal";
    int ret = -1;
    char p1[10240];
    char p2[10240];

    if(mod == 0 ){   //初始化
        ret = pub::Init(inp.toLocal8Bit().data(), p1);
    }else if(mod == 3){          //读卡
        ret = pub::ReadCardBas(p1, p2);

    }else if(mod == 2){
        ret = pub::ReadSFZ(p1, p2);
    }else if(mod == 1){
        ret = pub::EcQuery( inp.toLocal8Bit().data(), p1 );
    }
   // 发送结束信号
   qDebug()<<"finish the work and sent the resultReady signal";

   pub::cardFinish = true;
   pub::cardRet1 = QString::fromLocal8Bit(p1);
   pub::cardRet2 = QString::fromLocal8Bit(p2);
   pub::cardResult = ret;
   emit resultReady(ret, QString::fromLocal8Bit(p1),QString::fromLocal8Bit(p2));
}

